package aop;

import org.aspectj.lang.annotation.Aspect;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

/**
 * @author jackcfan
 * @date 2021/10/3
 */
@Aspect                 // 声明为切面
@Configuration
@EnableAspectJAutoProxy // 激活 AspectJ 代理
public class AspectJTest {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
        context.register(AspectJTest.class);
        context.refresh();

        AspectJTest bean = context.getBean(AspectJTest.class);
        // aop.AspectJTest$$EnhancerBySpringCGLIB$$113d09f1@2aa5fe93
        System.out.println(bean);

        context.close();
    }
}
